<cfparam name="organizationID" type="integer">
<cfparam name="rv" type="string" default="organizations">

<cfset organization = application.organizationGateway.get(organizationID)>

<cfoutput>

	<cfif organization.getOrganization_ID() gt 0>

		<cfset county = application.countyGateway.get(organization.getCounty_ID())>

		<cfif authUser.getRole() neq "Site Contact">
			<cfset canEdit = true>
		<cfelse>
			<cfset canEdit = false>
		</cfif>

		<cfif view eq "organization" or view eq "settings">
			<div class="buttonBar">
				<cfif view neq "settings">
					<a href="#script_name#?view=#rv#&organizationID=#organizationID#" class="formLink2">Back</a>
				</cfif>
				<cfif canEdit>
					<a href="#script_name#?view=editOrganization&rv=#view#&organizationID=#organizationID#" class="formLink">Edit</a>
				</cfif>
			</div>
		</cfif>

		<table class="panel">
        	<thead>
        		<tr>
        			<th colspan="2">Organization</th>
        		</tr>
        	</thead>
        	<tbody>
        		<cfif organizationID gt 0>
	        		<tr>
	        			<th>Organization ID:</th>
	        			<td>#organization.getOrganization_ID()#</td>
	        		</tr>
				</cfif>
				<tr>
        			<th>Status:</th>
        			<td><cfif organization.getApproved()>Approved<cfelse><cfif IsUserInRole("Super User") or IsUserInRole("Regional Admin")><font color="red">Not approved</font><cfelse>Pending approval</cfif></cfif></td>
        		</tr>
				<tr>
        			<th>Organization:</th>
        			<td>#organization.getOrganization()#</td>
        		</tr>
				<tr>
        			<th>Address:</th>
        			<td>#organization.getAddress()#</td>
        		</tr>
				<tr>
        			<th>City:</th>
        			<td>#organization.getCity()#</td>
        		</tr>
				<tr>
        			<th>Zip Code:</th>
        			<td>#organization.getZip_Code()#</td>
        		</tr>
				<tr>
        			<th>County:</th>
        			<td>#county.getCounty()#</td>
        		</tr>
				<tr>
        			<th>Region:</th>
        			<td>#county.getRegion()#<cfif ListLast(county.getRegion(), " ") neq "Region"> Region</cfif> (#county.getRegion_ID()#)</td>
        		</tr>
        	</tbody>
        </table>

		<cfif view eq "organization" or view eq "settings">

			<div style="line-height: 20px;">
				<cfif organization.getPA() eq 1>
					<a href="#script_name#?view=PA&rv=#view#&organizationID=#organizationID#"><img src="/applications/admin/common/images/right-arrow.gif" height="9" width="9" border="0">&nbsp;Partnership Agreement</a><br>
				<cfelse>
					<a href="#script_name#?view=editPA&rv=#view#&organizationID=#organizationID#"><img src="/applications/admin/common/images/right-arrow.gif" height="9" width="9" border="0">&nbsp;Partnership Agreement</a> (<font color="red">Not completed</font>)<br>
				</cfif>
				<cfif Len(Trim(organization.getOAP())) gt 0>
					<a href="#script_name#?view=OAP&rv=#view#&organizationID=#organizationID#"><img src="/applications/admin/common/images/right-arrow.gif" height="9" width="9" border="0">&nbsp;Outreach Action Plan</a>
				<cfelse>
					<a href="#script_name#?view=editOAP&rv=#view#&organizationID=#organizationID#"><img src="/applications/admin/common/images/right-arrow.gif" height="9" width="9" border="0">&nbsp;Outreach Action Plan</a> (<font color="red">Not completed</font>)
				</cfif>
			</div>

		</cfif>

	<cfelse>

		<div class="alert alert-info notFound">Organization not found</div>

	</cfif>

</cfoutput>